#include "LinkList.h"

typedef struct Person {
    char name[64];
    int age;
    int score;
}Person;

void MyPrint(void* data) {
    Person* p = (Person*)data;
    printf("Name:%s Age:%d Score:%d\n",p->name,p->age,p->score);
}

int main() {

    //创建链表
    LinkNode* list = Init_LinkList();

    //创建数据
    Person p1 = {"aaa",23,80};
    Person p2 = {"bbb",24,81};
    Person p3 = {"ccc",25,82};
    Person p4 = {"ddd",26,83};
    Person p5 = {"eee",27,84};

    //数据插入链表
    Insert_LinkList(list,0,&p1);
    Insert_LinkList(list,1,&p2);
    Insert_LinkList(list,2,&p3);
    Insert_LinkList(list,3,&p4);
    Insert_LinkList(list,4,&p5);

    //打印
    Print_LinkList(list,MyPrint);

    printf("==========================\n");

    //删除
    RemoveByPos_LinkList(list,3);
    Print_LinkList(list,MyPrint);

    //销毁链表
    FreeSpace_LinkList(list);
    return 0;
}